<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<table width="1200px" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td colspan="2">
		<h2>Irrealworld</h2>
		</td>
	</tr>
	<tr>
		<td><a href="overview.php"><b>Обзор</b></a><br />
		<br />
		<a href="ress.php"><b>Рессурсы</b></a><br />
		<br />
		<a href="p_buildings.php"><b>Мирные Здания</b></a><br />
		<br />
		<a href="w_buildings.php"><b>Военные Здания</b></a><br />
		<br />
		<a href="haven.php"><b>Гавань</b></a><br />
		<br />
		<a href="market.php"><b>Рынок</b></a><br />
		<br />
		<a href="protection.php"><b>Оборона</b></a><br />
		<br />
		<a href="research.php"><b>Исследования</b></a><br />
		<br />
		<a href="aliance.php"><b>Альянс</b></a><br />
		<br />
		<a href="post.php"><b>Почта</b></a><br />
		<br />
		<a href="map.php"><b>Карта</b></a><br />
		<br />
		<a href="exit.php"><b>Выход</b></a><br />
		<br />
		</td>
		<td style="vertical-align: top"><?php 
		$nick = $_SESSION["nickname"];
		echo "<i align=right>Hello ".$nick."</i><br>";
		connect();

		$townid = mysqli_query($dbc, "SELECT townid FROM users WHERE login LIKE '$nick' LIMIT 1");
		$townid = mysqli_fetch_row($townid);
		$townid = $townid[0];
		//update the ressources
		updateResourcesOfId($dbc, $townid);

		//fetch updated ressources
		$query = mysqli_query($dbc, "SELECT gold, stone, wood, metal FROM resources WHERE townid='$townid'");
		$query = mysqli_fetch_row($query);
		$gold = $query[0];
		$stone = $query[1];
		$wood = $query[2];
		$metal = $query[3];
		$max = testLagerCapacity($dbc, $townid);
		if($max==$metal || $max==$gold || $max==$wood || $max==$stone){
			printf(" Gold: %d, Stone:%d Wood:%d Metal:%d ",$gold,$stone,$wood,$metal);
			echo "<font color=\"#FF0000\"> --->Склад переполнен!</font>";
		}else { printf(" Gold: %d, Stone:%d Wood:%d Metal:%d ",$gold,$stone,$wood,$metal); }
		?>